<!-- 
	https://www.cnblogs.com/web928943/p/14976239.html
-->

<html>
	<head>
		<script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>
		<script>
			/*
			*/
			window.addEventListener("paste", function (e) {
				if (!(e.clipboardData && e.clipboardData.items)) {
					return;
				}
				for (var i = 0, len = e.clipboardData.items.length; i < len; i++){
					var itemz = e.clipboardData.items[i];
					console.log('itemz.kind:', itemz.kind, 'itemz:', itemz)
					if (itemz.kind === "string") {
						itemz.getAsString(function (str) {
						//  alert(str);
							console.log('str:', str)
						});
					}  else if(itemz.kind === "file") {
						console.log('file:')
						var pasteFile = itemz.getAsFile();
						alert(pasteFile);
					}
					 
				}
			})
			
			window.onload = function() {
				/*
				const read = new FileReader();
				read.readAsDataURL("file:///C:\Users\metareco\AppData\Local\Temp\ksohtml2964\wps1.jpg");
				read.onload = e => {
					var img = document.createElement('img');
					// img.src=e.target.result

					img.setAttribute('src', e.target.result);
					document.getElementById("div1").appendChild(img);
				};
				*/
			}	
		</script>
	</head>
	<body>
		<div id="div1">
		</div>
	</body>

</html>
